﻿using System;

using NUnit.Framework;
using Spring.Testing.NUnit;

using VisualAgile.Model;
using VisualAgile.IDAL;

namespace VisualAgile.DAL.Tests
{
    [TestFixture]
    public class IterationDaoTest : AbstractTransactionalDbProviderSpringContextTests
    {
        protected override string[] ConfigLocations
        {
            get
            {
                return new String[] { "objects.xml" };
            }
        }

        protected IIterationDao IterationDao
        {
            get
            {
                return applicationContext.GetObject("IterationDao") as IIterationDao;
            }
        }

        [Test]
        public void SaveIterationTest()
        {
            Iteration iteration = new Iteration();

            iteration.CreateTime = DateTime.Now;
            iteration.Name = "New Iteration"; // hard coded default Iteration text
            iteration.PeriodFrom = DateTime.Now;
            iteration.PeriodTo = DateTime.Now.AddDays(13);

            IterationDao.Save(iteration);
            transactionManager.Commit(transactionStatus);
        }       
    }
}
